//
//  MyImageView.m
//  PhotoWall
//
//  Created by LZXuan on 15-5-14.
//  Copyright (c) 2015年 轩哥. All rights reserved.
//

#import "MyImageView.h"
@interface MyImageView ()
@property (nonatomic,assign) id target;
@property (nonatomic,assign) SEL action;
@end
@implementation MyImageView

- (void)addTarget:(id)target action:(SEL)action {
    //打开用户交互
    self.userInteractionEnabled = YES;
    //保存
    self.target = target;
    self.action = action;
}
//用UITouch 增加一个点击事件
//手指 离开 屏幕的时候触发
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
    if ([self.target respondsToSelector:self.action]) {
        //点击 屏幕 手指离开的时候 让self.target 调用 self.action
        [self.target performSelector:self.action withObject:self];
    }else{
        NSLog(@"没有实现方法");
    }
}

@end





